package com.example.xm.adapter.HomeAdapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.xm.R;
import com.example.xm.base.BaseAdapter;
import com.example.xm.bean.HomeBean.HomeArticleBean;

import java.util.List;

public class HomeArticleAdapter extends BaseAdapter {


    public HomeArticleAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_home_article_itme;
    }

    @Override
    protected void bindData(BaseViewHolder viewHolder, Object o) {
        ImageView img = (ImageView) viewHolder.getViewById(R.id.iv_img);
        TextView title = (TextView) viewHolder.getViewById(R.id.tv_title_article);
        TextView data = (TextView) viewHolder.getViewById(R.id.tv_data_article_item);
        TextView name = (TextView) viewHolder.getViewById(R.id.tv_name_article);
        TextView date = (TextView) viewHolder.getViewById(R.id.tv_date_article);
        HomeArticleBean.DataBean.ArticlesBean bean = (HomeArticleBean.DataBean.ArticlesBean) o;
        img.setAlpha(0.5f);
        Glide.with(context).load(bean.getCover()).into(img);
        title.setText(bean.getTitle());
        data.setText(bean.getContentDescribe());
        name.setText(bean.getFullName());
        date.setText(bean.getCreateTime());
    }
}
